/*! For license information please see sdk.js.LICENSE.txt */!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("liff",[],t):"object"==typeof exports?exports.liff=t():e.liff=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="https://static.line-scdn.net/liff/edge/2/",n(n.s=9)}([function(e,t,n){"use strict";t.a=function(e){var t=this.constructor;return this.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){return t.reject(n)}))}))}},function(e,t,n){"use strict";t.a=function(e){return new this((function(t,n){if(!e||void 0===e.length)return n(new TypeError(typeof e+" "+e+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var r=Array.prototype.slice.call(e);if(0===r.length)return t([]);var o=r.length;function i(e,n){if(n&&("object"==typeof n||"function"==typeof n)){var a=n.then;if("function"==typeof a)return void a.call(n,(function(t){i(e,t)}),(function(n){r[e]={status:"rejected",reason:n},0==--o&&t(r)}))}r[e]={status:"fulfilled",value:n},0==--o&&t(r)}for(var a=0;a>>t|e<<32-t}for(var r,o,i=Math.pow,a=i(2,32),s="",u=[],c=8*t.length,l=e.h=e.h||[],f=e.k=e.k||[],h=f.length,d={},p=2;h<64;p++)if(!d[p]){for(r=0;r<313;r+=p)d[r]=p;l[h]=i(p,.5)*a|0,f[h++]=i(p,1/3)*a|0}for(t+="€";t.length%64-56;)t+="\0";for(r=0;r>8)return;u[r>>2]|=o<<(3-r)%4*8}for(u[u.length]=c/a|0,u[u.length]=c,o=0;o>>3)+v[r-7]+(n(w,17)^n(w,19)^w>>>10)|0);(l=[I+((n(m,2)^n(m,13)^n(m,22))+(m&l[1]^m&l[2]^l[1]&l[2]))|0].concat(l))[4]=l[4]+I|0}for(r=0;r<8;r++)l[r]=l[r]+b[r]|0}for(r=0;r<8;r++)for(o=3;o+1;o--){var T=l[r]>>8*o&255;s+=(T<16?0:"")+T.toString(16)}return s};return e.code='var sha256=function a(b){function c(a,b){return a>>>b|a<<32-b}for(var d,e,f=Math.pow,g=f(2,32),h="length",i="",j=[],k=8*b[h],l=a.h=a.h||[],m=a.k=a.k||[],n=m[h],o={},p=2;64>n;p++)if(!o[p]){for(d=0;313>d;d+=p)o[d]=p;l[n]=f(p,.5)*g|0,m[n++]=f(p,1/3)*g|0}for(b+="\\x80";b[h]%64-56;)b+="\\x00";for(d=0;d>8)return;j[d>>2]|=e<<(3-d)%4*8}for(j[j[h]]=k/g|0,j[j[h]]=k,e=0;ed;d++){var s=q[d-15],t=q[d-2],u=l[0],v=l[4],w=l[7]+(c(v,6)^c(v,11)^c(v,25))+(v&l[5]^~v&l[6])+m[d]+(q[d]=16>d?q[d]:q[d-16]+(c(s,7)^c(s,18)^s>>>3)+q[d-7]+(c(t,17)^c(t,19)^t>>>10)|0),x=(c(u,2)^c(u,13)^c(u,22))+(u&l[1]^u&l[2]^l[1]&l[2]);l=[w+x|0].concat(l),l[4]=l[4]+w|0}for(d=0;8>d;d++)l[d]=l[d]+r[d]|0}for(d=0;8>d;d++)for(e=3;e+1;e--){var y=l[d]>>8*e&255;i+=(16>y?0:"")+y.toString(16)}return i};',e})?r.apply(t,o):r)||(e.exports=i)},function(e,t,n){"use strict";(function(e){var t=n(3),r=n(0),o=n(1),i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;throw new Error("unable to locate global object")}();"function"!=typeof i.Promise?i.Promise=t.a:i.Promise.prototype.finally?i.Promise.allSettled||(i.Promise.allSettled=o.a):i.Promise.prototype.finally=r.a}).call(this,n(2))},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(7),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(2))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,a,s,u=1,c={},l=!1,f=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){p(e.data)},r=function(e){i.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(p,0,e)}:(a="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&p(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(a+t,"*")}),h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n1)for(var n=1;n-1};function f(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function h(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i&&(t[Symbol.iterator]=function(){return t}),t}function p(e){this.map={},e instanceof p?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function v(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function b(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function y(e){var t=new FileReader,n=b(t);return t.readAsArrayBuffer(e),n}function w(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:a&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:s&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:o&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():u&&a&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=w(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=w(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var e=v(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=v(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(y)}),this.text=function(){var e,t,n,r=v(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=b(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var i=/([?&])_=[^&]*/;if(i.test(this.url))this.url=this.url.replace(i,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function T(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}})),t}function E(e,t){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new p(t.headers),this.url=t.url||"",this._initBody(e)}I.prototype.clone=function(){return new I(this,{body:this._bodyInit})},m.call(I.prototype),m.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},E.error=function(){var e=new E(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];E.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new E(null,{status:t,headers:{location:e}})};var _=r.DOMException;try{new _}catch($r){(_=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack}).prototype=Object.create(Error.prototype),_.prototype.constructor=_}function O(e,t){return new Promise((function(n,o){var i=new I(e,t);if(i.signal&&i.signal.aborted)return o(new _("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new p,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}})),t)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;setTimeout((function(){n(new E(o,r))}),0)},s.onerror=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},s.ontimeout=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},s.onabort=function(){setTimeout((function(){o(new _("Aborted","AbortError"))}),0)},s.open(i.method,function(e){try{return""===e&&r.location.href?r.location.href:e}catch(t){return e}}(i.url),!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&(a?s.responseType="blob":u&&i.headers.get("Content-Type")&&-1!==i.headers.get("Content-Type").indexOf("application/octet-stream")&&(s.responseType="arraybuffer")),!t||"object"!=typeof t.headers||t.headers instanceof p?i.headers.forEach((function(e,t){s.setRequestHeader(t,e)})):Object.getOwnPropertyNames(t.headers).forEach((function(e){s.setRequestHeader(e,h(t.headers[e]))})),i.signal&&(i.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&i.signal.removeEventListener("abort",c)}),s.send(void 0===i._bodyInit?null:i._bodyInit)}))}O.polyfill=!0,r.fetch||(r.fetch=O,r.Headers=p,r.Request=I,r.Response=E);n(5);var k=function(){return(k=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}Object.create;Object.create;function A(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function F(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function D(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}Object.create;var B="INVALID_ARGUMENT",M="INIT_FAILED",W="INVALID_CONFIG",G="INVALID_ID_TOKEN",H="EXCEPTION_IN_SUBWINDOW",V={ACCESS_TOKEN:"accessToken",ID_TOKEN:"IDToken",DECODED_ID_TOKEN:"decodedIDToken",FEATURE_TOKEN:"featureToken",LOGIN_TMP:"loginTmp",CONFIG:"config",CONTEXT:"context",EXPIRES:"expires",RAW_CONTEXT:"rawContext",CLIENT_ID:"clientId",IS_SUBSEQUENT_LIFF_APP:"isSubsequentLiffApp",MST_CHALLENGE:"mstChallenge",MSIT:"msit",MST:"mst",MST_VERIFIER:"mstVerifier",APP_DATA:"appData",AUTOLOGIN_ATTEMPT:"autologinAttempt"},K="isInClient",J=["context_token","feature_token","access_token","id_token","client_id","mst_verifier","mst_challenge","msit"],q=["liff.ref.source","liff.ref.medium","liff.ref.campaign","liff.ref.term","liff.ref.content"],z="cancel",Z="submit",X=["profile","chat_message.write","openid","email"];function $(e){return window.atob(e.replace(/-/g,"+").replace(/_/g,"/"))}var Q={decode:$,encode:function(e){return window.btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},decodeUnicode:function(e){var t=$(e).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join("");return decodeURIComponent(t)}};function Y(e,t){if(e===t)return 0;for(var n=e.split("."),r=t.split("."),o=Math.max(n.length,r.length),i=0;i0?1:-1}return 0}function ee(e){var t=e.replace("#","").match(/.{2}/g)||[];if(4!==t.length)return N.warn("convertArgbToRgba: Received invalid ARGB color"),"";var n=function(e){var t=te(e);return Math.round(t/255*100)/100}(t[0]);return"rgba("+te(t[1])+", "+te(t[2])+", "+te(t[3])+", "+n+")"}function te(e){return parseInt(e,16)}function ne(e){var t=e.replace("#","").match(/.{2}/g)||[];return 3!==t.length?(N.warn("convertArgbToRgba: Received invalid hex color"),""):te(t[0])+", "+te(t[1])+", "+te(t[2])}function re(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o0})).reduce((function(e,t){var n=D(t.split("=").map(decodeURIComponent),2),r=n[0],o=n[1],i=e[r];return Array.isArray(i)?i.push(o):Object.prototype.hasOwnProperty.call(e,r)?e[r]=[i,o]:e[r]=o,e}),{})},de=function(e){return Object.keys(e).map((function(t){var n=e[t],r=function(e){return void 0!==e?encodeURIComponent(t)+"="+encodeURIComponent(e):encodeURIComponent(t)};return Array.isArray(n)?n.map((function(e){return r(e)})).join("&"):r(n)})).join("&")},pe="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function ve(e){for(var t="",n=0;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&Y(n,e)>=0}function ut(e){var t=at(e);if(!t)return!1;var n=t.permission,r=t.minVer,o=t.unsupportedFromVer;return!!n&&!!Oe()&&st(r,o)}var ct={shareTargetPicker:function(){if(!Xe())return!1;var e=at("shareTargetPicker");if(!e)return!1;var t=e.permission,n=e.minVer;if(!t)return!1;if(Oe()){var r=Qe();return null!==r&&Y(r,n)>=0}return!0},multipleLiffTransition:function(){var e=at("multipleLiffTransition");if(!e)return!1;var t=e.permission;return Oe()&&t},subwindowOpen:function(){var e=at("subwindowOpen");return!(!e||!e.permission)&&(!Oe()||st(e.minVer,e.unsupportedFromVer))},scanCode:function(){return ut("scanCode")},scanCodeV2:function(){var e=at("scanCodeV2");return!(!e||!e.permission)&&(!Oe()||st(e.minVer))},getAdvertisingId:function(){return ut("getAdvertisingId")},addToHomeScreen:function(){return ut("addToHomeScreen")},bluetoothLeFunction:function(){return ut("bluetoothLeFunction")},skipChannelVerificationScreen:function(){return ut("skipChannelVerificationScreen")}};function lt(e){if(!it.includes(e))throw ce(B,"Unexpected API name.");var t=ct[e];return!t||t()}function ft(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(t){i(t)}}function s(e){try{u(r.throw(e))}catch(t){i(t)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function ht(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}Object.create;var pt=function(){return(pt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=0&&n.splice(r,1)}}function xt(e,t,n){void 0===t&&(t={}),void 0===n&&(n="");var r=De();if(!r)throw ce("FORBIDDEN","Invalid featureToken for client features");if(!window._liff||!window._liff.postMessage)throw ce(B,"postMessage is not available from client");N.debug("[js postMessage to client]",e,n,t),window._liff.postMessage(e,r,n,JSON.stringify(t))}function At(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={once:!0}),De()?(n=_t({callbackId:ve(12),once:!0},n),new Promise((function(r,o){var i=function(t){if(t&&t.detail){var a=t.detail.callbackId===n.callbackId,s="string"!=typeof t.detail.callbackId;(a||s)&&(n.once&&Ct(e,i),N.debug("[callback detail]",t.detail),t.detail.error?o(t.detail.error):t.detail.data?r(t.detail.data):o(t.detail))}o()};Pt(e,i),xt(e,t,n.callbackId)}))):Promise.reject(ce("FORBIDDEN","Invalid featureToken for client features"))}function Ft(){var e=Qe();null!==e&&("ios"===$e()&&Y(e,"9.19")>=0||"android"===$e()&&Y(e,"11.6.0")>=0)?location.href="liff://close":window._liff&&window._liff.postMessage?null!==e&&Y(e,"10.15.0")>=0?"ios"===$e()?window._liff.postMessage("closeWindow",""):window._liff.postMessage("closeWindow","","",""):At("closeWindow"):window.close()}function jt(e){return mt(Et("subWindowGetOrigin")(e))}var Lt={};function Nt(e,t){e&&Lt[e]&&Lt[e].forEach((function(e){e(t)}))}var Ut,Rt,Dt,Bt,Mt=function(){function e(e){this.storage=e}return e.prototype.getItem=function(e){return this.storage.getItem(this.getKeyPrefix()+":"+e)},e.prototype.setItem=function(e,t){this.storage.setItem(this.getKeyPrefix()+":"+e,t)},e.prototype.removeItem=function(e){this.storage.removeItem(this.getKeyPrefix()+":"+e)},e.prototype.clear=function(){this.storage.clear()},e.prototype.getKeyPrefix=function(){return"LIFF_STORE:"+this.getLiffId()},e.prototype.getLiffId=function(){var e=Ce().liffId;if(!e)throw ce(W,"liffId is necessary for liff.init()");return e},e}(),Wt=new Mt(fe);function Gt(){var e=Wt.getItem("subWindowStatusUpdated");return null!==e&&JSON.parse(e)}function Ht(e){Wt.setItem("subWindowStatusUpdated",String(e))}function Vt(e){Ut=e}function Kt(){return Ut}function Jt(){return Dt}function qt(){return Bt}var zt=new Mt(window.sessionStorage);function Zt(){return zt.getItem("mainWindowOrigin")}function Xt(e,t){return void 0===t&&(t={}),ft(this,void 0,void 0,(function(){var n,r,o,i,a,s,u;return ht(this,(function(c){switch(c.label){case 0:if(n=Ce().liffId,r=Zt(),!window.opener||!r||!n)throw ce(H);o=!1,c.label=1;case 1:return c.trys.push([1,3,,4]),[4,jt(n)];case 2:return i=c.sent(),o=i.subwindowCommonModule,[3,4];case 3:throw a=c.sent(),N.debug(a),ce(H);case 4:return s=JSON.stringify(t),u=o?r:location.origin,[2,new Promise((function(t){window.addEventListener("message",(function n(r){(function(e){return!(!e.data||"string"!=typeof e.data.type||![Z,z].includes(e.data.type))})(r)&&(window.removeEventListener("message",n),t({status:e,result:s}))})),window.opener.postMessage({status:e,result:s},u)}))]}}))}))}function $t(e){var t,n=qt();if(e.origin===n){var r=e.data;if(r){var o,i=r.status,a=r.result;try{o=JSON.parse(a||"{}")}catch(s){o={}}switch(i){case"healthCheck":window.clearInterval(Jt());break;case z:case Z:Ht(!0),window.clearInterval(Jt()),window.removeEventListener("message",$t),Nt(i,o),null===(t=Kt())||void 0===t||t.postMessage({type:i},qt());break;default:N.debug("unexpected message")}}}}function Qt(){window.clearInterval(Rt),window.clearInterval(Jt()),window.removeEventListener("message",$t)}function Yt(e){var t=ge(e.url);if(!t)return Promise.reject(ce(B,"params.url must be liff url"));!function(){Qt(),Ht(!1);var e=Kt();e&&(e.close(),Vt(null))}();var n,r=e.url,o=e.appData,i=new URL(r);i.searchParams.append("liff.subwindow","true"),i.hostname=function(){for(var e=[],t=0;t=500?[4,tn()]:[3,9];case 7:return h.sent(),[4,rn(en,{msit:t,mstChallenge:n,onSuccess:r,onError:o,reconnectCount:a+=1})];case 8:return h.sent(),[3,20];case 9:return s.status>=400&&500>s.status?[4,nn(s)]:[3,11];case 10:return(c=h.sent())?(u=c.errorDetail,o(ce(B,u))):o(ce("UNKNOWN","Some error happened in the server")),[3,20];case 11:return 200!==s.status?[3,19]:[4,nn(s)];case 12:return(c=h.sent())?[3,13]:(o(ce("UNKNOWN","Some error happened in the server")),[3,18]);case 13:switch(l=c.status,f=c.result,l){case"error":return[3,14];case"close":case z:case Z:return[3,16]}return[3,17];case 14:return[4,rn(en,{msit:t,mstChallenge:n,onSuccess:r,onError:o,reconnectCount:a})];case 15:return h.sent(),[3,18];case 16:return r(l,f),[3,18];case 17:o(ce("UNKNOWN","Some error happened in the server")),h.label=18;case 18:return[3,20];case 19:o(ce("UNKNOWN","Some error happened in the server")),h.label=20;case 20:return[2]}}))}))}function tn(){return new Promise((function(e){return setTimeout(e,1e3)}))}function nn(e){return ft(this,void 0,void 0,(function(){return ht(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e.json()];case 1:return[2,t.sent()];case 2:return t.sent(),[2,null];case 3:return[2]}}))}))}function rn(e,t){return ft(this,void 0,void 0,(function(){return ht(this,(function(n){switch(n.label){case 0:return t.reconnectCount>=10?(t.onError(ce("UNKNOWN","Failed to connect")),[3,3]):[3,1];case 1:return[4,e(t)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))}function on(e){var t={};return Object.keys(e).forEach((function(n){"closeButtonColor"===n?"white"===e[n]?t[n]="#ffffff":t[n]="#000000":t[n]=e[n]})),t}var an={height:"full",closeButtonPosition:"right",closeButtonColor:"black",closeButtonLabel:""};function sn(){if(!ot())throw ce("UNAUTHORIZED","this api can be only called in child window")}function un(e){if(!e.mst||!e.status)return Promise.reject(ce(B,"no proper argument"));var t=JSON.stringify(e);return mt(Et("subWindowPost"),{method:"POST",body:t})}function cn(e){var t=e.msit,n=e.mstVerifier;return t&&n?mt(Et("subWindowGetMSTByMSIT"),{method:"POST",body:JSON.stringify({msit:t,mstVerifier:n})}):Promise.reject(ce(B,"no proper argument"))}function ln(e){var t=e.mst;return t?mt(Et("subWindowGetAppData"),{method:"POST",body:JSON.stringify({mst:t})}):Promise.reject(ce(B,"no proper argument"))}var fn={on:function(e,t){Lt[e]||(Lt[e]=[]),Lt[e].push(t)},off:function(e,t){if(Lt[e]){var n=Lt[e].indexOf(t);n>=0&&Lt[e].splice(n,1)}},open:function(e){if(!lt("subwindowOpen"))throw ce("FORBIDDEN","No permission for liff.subWindow.open()");return function(){if(ot())throw ce("UNAUTHORIZED","this api can be only called in parent window")}(),Oe()?function(e){var t=e.appData,n=e.native,r=Ce().liffId,o=Ue(),i=ge(e.url);if(!r)return Promise.reject(ce("UNAUTHORIZED","liffId is invalid"));if(!o)return Promise.reject(ce("UNAUTHORIZED","mst_challenge is invalid"));if(!i)return Promise.reject(ce(B,"params.url must be liff url"));var a=Object.assign({},an,n);return function(e){var t=e.mainLiffId,n=e.subLiffId,r=e.mstChallenge,o=e.appData,i=e.view;return t&&r?mt(Et("subWindowGetMSIT"),{method:"POST",body:JSON.stringify({mainLiffId:t,subLiffId:n,mstChallenge:r,appData:o,view:i})}):Promise.reject(ce(B,"no proper argument"))}({mainLiffId:r,subLiffId:i,mstChallenge:o,appData:t,view:on(a)}).then((function(t){var n=t.msit;en({msit:n,mstChallenge:o,onSuccess:function(e,t){Nt(e,t)},onError:function(e){Nt("error",e)}}),function(e,t){var n=e.url,r=new URLSearchParams;r.set("msit",t),location.href="liff://subwindow?url="+encodeURIComponent(n)+"&"+r.toString()}(e,n)}))}(e):Yt(e)},cancel:function(e){return void 0===e&&(e={}),sn(),Oe()?function(e){return void 0===e&&(e={}),ft(this,void 0,void 0,(function(){var t,n;return ht(this,(function(r){switch(r.label){case 0:return(t=Ne())?[4,un({mst:t,status:z,result:e})]:[2,Promise.reject(ce("UNAUTHORIZED","mst is invalid"))];case 1:return n=r.sent(),Ht(!0),[2,n]}}))}))}(e):function(e){return void 0===e&&(e={}),Xt(z,e)}(e)},submit:function(e){return void 0===e&&(e={}),sn(),Oe()?function(e){return void 0===e&&(e={}),ft(this,void 0,void 0,(function(){var t,n;return ht(this,(function(r){switch(r.label){case 0:return(t=Ne())?[4,un({mst:t,status:Z,result:e})]:[2,Promise.reject(ce("UNAUTHORIZED","mst is invalid"))];case 1:return n=r.sent(),Ht(!0),[2,n]}}))}))}(e):function(e){return void 0===e&&(e={}),Xt(Z,e)}(e)},close:function(){return sn(),Oe()?function(){return ft(this,void 0,void 0,(function(){var e;return ht(this,(function(t){switch(t.label){case 0:return!1!==Gt()?[3,2]:(e=Ne())?[4,un({mst:e,status:"close",result:{}})]:[2,Promise.reject(ce("UNAUTHORIZED","mst is invalid"))];case 1:t.sent(),t.label=2;case 2:return Ft(),[2]}}))}))}():(Ft(),Promise.resolve())},getAppData:function(){return sn(),function(){var e,t=xe(V.APP_DATA);try{e=t?JSON.parse(t):{}}catch(n){e={}}return Promise.resolve(e)}()}};function hn(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(t){i(t)}}function s(e){try{u(r.throw(e))}catch(t){i(t)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function dn(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function bn(){for(var e=[],t=0;t0&&!e.startsWith("/")?"/":"")+e},e.prototype.invoke=function(){return P(this,void 0,void 0,(function(){var e,t,n,r,o;return C(this,(function(i){switch(i.label){case 0:if(e=he(window.location.search),"string"!=typeof(t=e["liff.state"]))return[2];i.label=1;case 1:return i.trys.push([1,4,,5]),n=location.href,(r=this.decodeState(t))===n?[3,3]:(e["liff.hback"]?location.replace(me(r,{"liff.hback":e["liff.hback"]})):location.replace(r),[4,new Promise((function(){}))]);case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:if((o=i.sent()).code===M)throw o;return N.debug(o),[3,5];case 5:return[2]}}))}))},e}());function Hn(e,t,n){return P(this,void 0,void 0,(function(){var r;return C(this,(function(o){switch(o.label){case 0:if(!t.liffId)throw ce(W,"liffId is necessary for liff.init()");return function(e){Pe=e}(t),!Oe()&&Xe()&&(function(){var e=Ce();return oe("LIFF_STORE:"+V.EXPIRES+":"+e.liffId)}()||et()),r=he(window.location.search),!ot()||Oe()?[3,2]:[4,new Promise((function(e){Zt()?e():window.addEventListener("message",(function t(n){var r=n.data,o=n.source,i=n.origin;if(r){var a=r.type,s=r.message;"healthCheck"===a&&(window.removeEventListener("message",t),s&&Le(s),function(e){zt.setItem("mainWindowOrigin",e)}(i),o&&o.postMessage&&o.postMessage({status:"healthCheck"},i),e())}}))}))];case 1:o.sent(),o.label=2;case 2:if(r.error&&r.liffOAuth2Error)throw s=r.error,u=r.error_description.replace(/\+/g," "),ce(M,s+": "+u);return i=r.code,a=Ke(),Boolean(i&&!Xe()&&a&&a.codeVerifier)?[4,Wn(r.liffClientId)]:[3,4];case 3:o.sent(),o.label=4;case 4:return Oe()?[4,Dn(e,t)]:[3,6];case 5:return o.sent(),[3,8];case 6:return Xe()?[3,8]:[4,Mn()];case 7:o.sent(),o.label=8;case 8:return[4,Gn.invoke()];case 9:return o.sent(),[4,n()];case 10:return o.sent(),function(e){var t=ye(be(e));window.history.replaceState(history.state,"",t)}(window.location.href),[2]}var i,a,s,u}))}))}var Vn=function(){function e(){this.hooks={before:new wn,after:new wn},this.internalHooks={beforeFinished:new wn,beforeSuccess:new wn,error:new wn}}return Object.defineProperty(e.prototype,"name",{get:function(){return"init"},enumerable:!1,configurable:!0}),e.prototype.install=function(e){var t=e.liff;return this.liff=t,this.init.bind(this)},e.prototype.init=function(e,t,n){return P(this,void 0,void 0,(function(){var r;return C(this,(function(o){switch(o.label){case 0:return[4,this.hooks.before.call()];case 1:o.sent(),i=this.liff,window&&!window.liff&&(window.liff=i),o.label=2;case 2:return o.trys.push([2,11,,13]),[4,Promise.all([Sn(this.liff),Hn(this.liff,e,this.internalHooks.beforeFinished.call)])];case 3:return o.sent(),function(){var e;En("color-scheme",((null==(e=Fe())?void 0:e.menuColorSetting)||{adaptableColorSchemes:["light"]}).adaptableColorSchemes.join(" "));var t=window.matchMedia("(prefers-color-scheme: dark)");In({matches:null==t?void 0:t.matches,media:null==t?void 0:t.media}),t.addEventListener?t.addEventListener("change",In):t.addListener&&t.addListener(In)}(),[4,this.internalHooks.beforeSuccess.call()];case 4:if(o.sent(),!e.withLoginOnExternalBrowser||Xe())return[3,8];if(!xe(V.AUTOLOGIN_ATTEMPT))return[3,5];throw ce(M,"Auto login failure");case 5:return Ae(V.AUTOLOGIN_ATTEMPT,!0),this.liff.login(),[4,new Promise((function(){}))];case 6:o.sent(),o.label=7;case 7:return[3,9];case 8:e.withLoginOnExternalBrowser&&Ae(V.AUTOLOGIN_ATTEMPT,!1),o.label=9;case 9:return[4,this.hooks.after.call()];case 10:return o.sent(),"function"==typeof t&&t(),Ee(),[3,13];case 11:return r=o.sent(),[4,this.internalHooks.error.call(r)];case 12:throw o.sent(),"function"==typeof n&&n(r),r;case 13:return[2]}var i}))}))},e}();function Kn(){return"2.19.0"}var Jn=n(4),qn=n.n(Jn),zn=function(){function e(){this.hooks={before:new yn}}return Object.defineProperty(e.prototype,"name",{get:function(){return"login"},enumerable:!1,configurable:!0}),e.prototype.install=function(){return this.login.bind(this)},e.prototype.login=function(e){this.hooks.before.call(e);var t,n,r=ve(43),o=(t=qn()(r),n="",t.replace(/\r|\n/g,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ").forEach((function(e){n+=String.fromCharCode(parseInt(e))})),window.btoa(n)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),i=Ce();if(!i||!i.liffId)throw ce(W,"You need to define `liffId` for liff.login()");var a={app_id:i.liffId,state:ve(12),response_type:"code",code_challenge_method:"S256",code_challenge:o,liff_sdk_version:"2.19.0"};e&&e.redirectUri&&(a.redirect_uri=e.redirectUri),ot()&&!Oe()&&(a.disable_auto_login="true"),function(e){Ae(V.LOGIN_TMP,e)}({codeVerifier:r});var s=Et("authorize")+"?"+de(a);N.debug("[Redirect] "+s),window.location.href=s},e}();function Zn(){return mt(Et("profile"))}Object.create;function Xn(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}Object.create;var $n=function(e){return"object"==typeof e&&null!==e&&function(e){return"string"==typeof e||e instanceof String}(e.type)};function Qn(e){return Promise.reject(ce(B,e))}var Yn=function(e){if("403"===e.code){var t="12.0.0"===Qe(),n="ios"===$e(),r=Te();t&&(n||r)&&window.alert("LINEアプリをLINE 12.0.1以降にアップデートしてください。\nPlease update your LINE app to LINE 12.0.1 or later.")}throw e};var er=function(){return(er=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}Object.create;var nr=function(){function e(){this.modules=new Map,this.hooks={},this.internalHooks={}}return e.prototype.addModule=function(e,t){this.modules.set(e,t),t.hooks&&(this.hooks[e]=Object.entries(t.hooks).reduce((function(e,t){var n,r=tr(t,2),o=r[0],i=r[1];return er(er({},e),((n={})[o]=i.on.bind(i),n))}),{})),t.internalHooks&&(this.internalHooks[e]=Object.entries(t.internalHooks).reduce((function(e,t){var n,r=tr(t,2),o=r[0],i=r[1];return er(er({},e),((n={})[o]=i.on.bind(i),n))}),{}))},e.prototype.hasModule=function(e){return this.modules.has(e)},e}(),rr=function(){function e(e,t,n){this.driver=e,this.context=t,this.option=n}return e.prototype.install=function(){return this.factory(this.driver,this.context)},Object.defineProperty(e.prototype,"name",{get:function(){return"use"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultOption",{get:function(){return{namespacePrefix:"$"}},enumerable:!1,configurable:!0}),e.prototype.factory=function(e,t){var n=Object.assign({},this.defaultOption,this.option).namespacePrefix;return function(r,o){if(!r||"function"!=typeof r.install||"string"!=typeof r.name)return N.warn("To install the plugin, you need to define the `name` property and the `install` method."),this;var i=""+n+r.name;if(e.hasModule(i))return this;var a=r.install.call(r,t,o);return this[""+i]?(N.warn("There is a duplicate plugin name. `"+i+"` plugin namespace will be override."),this[""+i]=a):void 0!==a&&(this[""+i]=a),e.addModule(i,r),this}},e}();var or=function(){return(or=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&(this.referrer=t)},e.prototype.beforeInitFinished=function(){return ir(this,void 0,void 0,(function(){var t,n,r,o,i,a,s,u,c,l,f,h,d;return ar(this,(function(p){switch(p.label){case 0:if(t=he(window.location.search),this.prepareReferrer(t),n=Fe(),!(r=null==n?void 0:n.utsTracking))return[2];if("auto"!==(o=r.mode)&&"force"!==o)return[3,6];N.debug("[LIFFUTS] "+(new Date).toUTCString()),i=Ce(),a=i.liffId,s=i.analytics,p.label=1;case 1:return p.trys.push([1,3,,4]),u=this,[4,new Promise((function(e,t){var n=window.uts,r=document.createElement("script");r.type="text/javascript",r.src="https://static.line-scdn.net/uts/edge/4.1.0/uts.js",r.onload=function(){var t=window.uts;e(t),window.uts=n},r.onerror=function(e){t(e)},document.getElementsByTagName("head")[0].appendChild(r)}))];case 2:return u.uts=p.sent(),[3,4];case 3:return c=p.sent(),N.debug("[LIFFUTS] cannot load UTS, reason: "+c),[2];case 4:return l=void 0,f=void 0,"force"===o?(l={utsId:e.GENERAL_UTS_ID,appName:e.GENERAL_APP_NAME,appEnv:"release"},f={endpoint:"https://uts-front.line-apps.com",sampleRate:this.changeRatioToUTSFormat(r.sendRatio),version:"current"}):(l=or(or({},null==s?void 0:s.context),{utsId:(null==s?void 0:s.context.utsId)||e.GENERAL_UTS_ID,appName:(null==s?void 0:s.context.appName)||e.GENERAL_APP_NAME,appEnv:(null==s?void 0:s.context.appEnv)||"release"}),f=or(or({endpoint:"https://uts-front.line-apps.com"},null==s?void 0:s.options),{sampleRate:this.changeRatioToUTSFormat(r.sendRatio),version:"current"})),this.uts.init(l,f),[4,ur()];case 5:(h=p.sent())&&(N.debug("[LIFFUTS][mid] "+h),this.uts.setMid(h)),(null==n?void 0:n.tid)&&(N.debug("[LIFFUTS][tid] "+n.tid),this.uts.setTid(n.tid)),this.referrer&&(N.debug("liff.ref.referrer",this.referrer),this.uts.setSessionParams(this.referrer)),a&&this.setLiffId(a),this.setIsLoggedIn(Xe()),this.setVersion("2.19.0"),d=be(location.href),N.debug("[LIFFUTS][url] "+d),this.uts.setUrl(d),this.liffCore.analytics=this.uts,this.injected=!0,p.label=6;case 6:return[2]}}))}))},e.prototype.beforeInitSuccess=function(){return this.injected&&(this.setIsLiffSuccessful(!0),this.sendLiffInit()),Promise.resolve()},e.prototype.initError=function(){return this.injected&&(this.setIsLiffSuccessful(!1),this.sendLiffInit()),Promise.resolve()},e}();function lr(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(t){i(t)}}function s(e){try{u(r.throw(e))}catch(t){i(t)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function fr(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&"/"!==u[0]&&(u="/"+u);var c=new RegExp("^"+J.join("|")),l=i.substring(1).split("&").filter((function(e){return!c.test(e)&&Boolean(e)})).join("&"),f=l===s.hash.substring(1)?"":l,h=function(e){return e.substring(1).split("&").filter((function(e){return!/liff\.state/.test(e)&&Boolean(e)}))},d=h(o),p=h(s.search);e.extraParams&&d.push(e.extraParams);for(var v=0;v-1&&d.splice(y,1)}var w=d.join("&"),m=u+(""!==w?"?"+w:"")+(f?"#"+f:"");return"https://liff.line.me/"+Ce().liffId+m},this.createUrlBy=function(t){return lr(e,void 0,void 0,(function(){var e,n;return fr(this,(function(r){switch(r.label){case 0:if(!(e=Ce().liffId))throw ce(M,"Should run after liff init.");try{n=new URL(t)}catch(L){throw ce(B,"invalid URL.")}return[4,hr({liffId:e,currentPageUrl:n.toString()})];case 1:return[2,r.sent().permanentLinkUrl]}}))}))},this.setExtraQueryParam=function(t){e.extraParams=t},this.isAncestor=function(e,t){return 0===t.indexOf(e)&&(e.endsWith("/")&&(e=e.substring(0,e.length-1)),void 0===t[e.length]||"/"===t[e.length])},this.install=function(){return{createUrl:e.createUrl,createUrlBy:e.createUrlBy,setExtraQueryParam:e.setExtraQueryParam}}}return Object.defineProperty(e.prototype,"name",{get:function(){return"permanentLink"},enumerable:!1,configurable:!0}),e}());function pr(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(t){i(t)}}function s(e){try{u(r.throw(e))}catch(t){i(t)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function vr(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Er(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function Sr(){for(var e=[],t=0;t0?[4,new Promise((function(e,t){(Pr=new Fr(e,t)).open()}))]:[3,3];case 2:return He(t.sent().newAccessToken),[3,4];case 3:throw ce("FORBIDDEN","All permissions have already been approved.");case 4:return[2]}}))}))}function Lr(e,t){var n=this;return function(){for(var r=[],o=0;o0?r[r.length-1]:{}).ignorePermissionCheck,o=void 0!==n&&n,[4,_r(t)];case 1:if("unavailable"!==(i=a.sent().state))return[3,2];throw ce("FORBIDDEN","The permission is not in LIFF app scope.");case 2:return"prompt"!==i||!Or()||o||!Oe()&&"chat_message.write"===t?[3,4]:[4,jr()];case 3:return a.sent(),[3,5];case 4:o&&r.pop(),a.label=5;case 5:return[4,e.apply(void 0,Sr(r))];case 6:return[2,a.sent()]}}))}))}}var Nr=new(function(){function e(){this.name="permission"}return e.prototype.install=function(){return{query:_r,requestAll:jr}},e}());function Ur(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(t){i(t)}}function s(e){try{u(r.throw(e))}catch(t){i(t)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function Rr(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}Object.create;var Br={};function Mr(e,t){var n=Br,r=Dr(t.split("."),1)[0],o=n[t];o&&e.removeEventListener(r,o),n[t]=null}var Wr=!1,Gr=!1;function Hr(e,t,n,r){if(void 0===n&&(n={}),"object"!=typeof e||!e.postMessage)throw ce(B,"target must be window object");if("string"!=typeof t)throw ce(B,"keyname must be string");if("object"!=typeof n)throw ce(B,"incorrect body format. It should be Object or Array comprised of Object");if(!r)throw ce(B,"serverEndPointUrl isn't passed. please fill up with proper url");if("*"===r)throw new Error("serverEndPointUrl doesn't allow to set '*'");var o={name:t,body:n};e.postMessage(o,r)}function Vr(e,t,n,r){!function(e,t,n,r){Wr||(Gr=function(){var e=!1;try{var n=Object.defineProperty({},"passive",{get:function(){return e=!0,!1}});window.addEventListener("test",n,n),window.removeEventListener("test",n,n)}catch(t){e=!1}return e}(),Wr=!0);var o=Dr(t.split("."),1)[0];new Promise((function(i){var a=function(o){i(o),n&&n(o),r&&r.once&&Mr(e,t)};!function(e,t){Br[e]=t}(t,a),e.addEventListener(o,a,!!Gr&&r)}))}(e,"message."+t,function(e,t,n){return function(r){N.debug("messageReceive",r),r.origin===n&&r.data.name===e&&t(r)}}(t,n,r))}var Kr=function(){function e(){this.payloadToShareTargetPicker=null,this.popupWindow=null,this.doesWaitForSubwindowResult=!1}return e.getInstance=function(){return e.instance?e.instance.reset():e.instance=new e,e.instance},e.prototype.init=function(e){return Ur(this,void 0,void 0,(function(){var t,n;return Rr(this,(function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),this.liffId=e.referrer.liffId,this.doesWaitForSubwindowResult=!(!e.options||!e.options.waitForSubwindowResult),this.allowPostMessageOrigin=this.initAllowPostMessageOrigin(),this.payloadToShareTargetPicker=this.buildPayloadToShareTargetPicker(e),window.AbortController&&(this.abortController=new window.AbortController),this.prepareAnotherWindow(),[4,this.initOtt()];case 1:return r.sent(),this.initListener(),this.openAnotherWindow(),this.doesWaitForSubwindowResult?[4,this.pollingShareResult()]:[3,3];case 2:return t=r.sent(),this.finalize(),[2,t];case 3:return[2];case 4:return[3,6];case 5:if(n=r.sent(),this.finalize(),"AbortError"!==n.name)throw n;return[3,6];case 6:return[2]}}))}))},e.prototype.resetAllVariables=function(){this.liffId="",this.allowPostMessageOrigin="",this.payloadToShareTargetPicker=null,this.ott="",this.popupWindow=null,this.timeoutIDForHealthCheck=null,this.abortController=null,this.internalError=null,this.doesWaitForSubwindowResult=!1},e.prototype.reset=function(){this.finalize(),this.resetAllVariables()},e.prototype.finalize=function(){var e,t;this.abortController&&this.abortController.abort(),Oe()||(e=this.timeoutIDForHealthCheck,t=this.popupWindow,Mr(window,"message.receivedHealthcheck"),e&&clearTimeout(e),t&&!t.closed&&t.close())},e.prototype.buildPayloadToShareTargetPicker=function(e){return{messages:e.messages,isMultiple:e.isMultiple,referrer:e.referrer}},e.prototype.initAllowPostMessageOrigin=function(e){return void 0===e&&(e=Et("shareTargetPicker")),function(e){var t=e.match(/^(https?:\/\/.*?)\//);return t&&t[1]||""}(e)},e.prototype.initOtt=function(){return Ur(this,void 0,void 0,(function(){var e,t,n;return Rr(this,(function(r){switch(r.label){case 0:return this.abortController&&(e=this.abortController.signal),t=Et("shareTargetPickerOtt")+"/"+this.liffId+"/ott",n=this,[4,mt(t,{method:"GET",signal:e}).then((function(e){return e.ott}))];case 1:return n.ott=r.sent(),[2]}}))}))},e.prototype.prepareAnotherWindow=function(){Oe()||("ios"!==$e()||Te()?this.popupWindow=window.open("","liffpopup","width=480, height=640, menubar=no, toolbar=no, scrollbars=yes"):this.popupWindow=window.open())},e.prototype.openAnotherWindow=function(){if(Oe()&&this.payloadToShareTargetPicker)e=this.liffId,t=this.ott,n=this.payloadToShareTargetPicker,r={liffId:e,ott:t,data:JSON.stringify(n),closeModals:!1},location.href="line://picker?"+de(r);else{if(this.timeoutIDForHealthCheck=window.setTimeout(this.healthCheck.bind(this),1e3),!this.popupWindow)throw ce("CREATE_SUBWINDOW_FAILED");!function(e,t,n){var r={liffId:t,ott:n};e.location.href=Et("shareTargetPicker")+"?"+de(r)}(this.popupWindow,this.liffId,this.ott)}var e,t,n,r},e.prototype.initListener=function(){var e,t;Oe()||(e=this.onReceivedHealthcheck.bind(this),t=this.allowPostMessageOrigin,Vr(window,"receivedHealthcheck",e,t))},e.prototype.healthCheck=function(){return Ur(this,void 0,void 0,(function(){var e;return Rr(this,(function(t){switch(t.label){case 0:if(this.popupWindow&&!this.popupWindow.closed)return[3,7];if(!this.doesWaitForSubwindowResult)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.onCanceled()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this.internalError=e,[3,4];case 4:return[3,6];case 5:this.finalize(),t.label=6;case 6:return[3,8];case 7:Hr(this.popupWindow,"healthcheck",void 0,this.allowPostMessageOrigin),this.timeoutIDForHealthCheck=window.setTimeout(this.healthCheck.bind(this),1e3),t.label=8;case 8:return[2]}}))}))},e.prototype.onReceivedHealthcheck=function(){if(!this.popupWindow||!this.payloadToShareTargetPicker)throw ce("CREATE_SUBWINDOW_FAILED");Hr(this.popupWindow,"ready",this.payloadToShareTargetPicker,this.allowPostMessageOrigin)},e.prototype.onCanceled=function(){return Ur(this,void 0,void 0,(function(){var e,t;return Rr(this,(function(n){switch(n.label){case 0:if(Oe()||!this.ott)throw new Error("need to call with ott in client");return this.abortController&&(e=this.abortController.signal),t={liffId:this.liffId,ott:this.ott},[4,mt(Et("shareTargetPickerResult")+"?"+de(t),{method:"POST",signal:e,headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:"result=CANCEL"})];case 1:return[2,"ok"===n.sent().status]}}))}))},e.prototype.getShareResult=function(){return Ur(this,void 0,void 0,(function(){var e,t;return Rr(this,(function(n){if(!this.ott)throw new Error("need to call with ott in client");return this.abortController&&(e=this.abortController.signal),t={liffId:this.liffId,ott:this.ott},N.debug("fetch: getShareResult"),[2,mt(Et("shareTargetPickerResult")+"?"+de(t),{method:"GET",headers:{Accept:"application/json"},signal:e})]}))}))},e.isPollingTimeOut=function(e,t){return(t-e)/6e4>=10},e.prototype.pollingShareResult=function(){return Ur(this,void 0,void 0,(function(){var t,n;return Rr(this,(function(r){switch(r.label){case 0:t=Date.now(),r.label=1;case 1:if(e.isPollingTimeOut(t,Date.now()))return[3,4];if(this.internalError)throw this.internalError;return[4,this.getShareResult()];case 2:if((n=r.sent())&&n.result)switch(n.result){case"SUCCESS":return[2,{status:"success"}];case"CANCEL":return[2];case"FAILURE":default:throw new Error(n.resultDescription)}return[4,new Promise((function(e){setTimeout(e,500)}))];case 3:return r.sent(),[3,1];case 4:throw new Error("Timeout: not finished within 10min")}}))}))},e}(),Jr=new(function(){function e(){var e=this;this.name="shareTargetPicker",this.shareTargetPicker=function(t,n){return void 0===n&&(n={}),Ur(e,void 0,void 0,(function(){var e,r,o,i,a,s,u;return Rr(this,(function(c){switch(c.label){case 0:if(e=void 0===n.isMultiple||n.isMultiple,this.checkPermission(),!Xe())throw ce("UNAUTHORIZED","Need access_token for api call, Please login first");if(!t||!Array.isArray(t)||0===t.length)throw ce(B,"no proper argument");if(t.length>5)throw ce(B,"exceed the limit of num of messages");if(!(r=Ce().liffId))throw ce(W);window.liff&&(o=window.liff).analytics&&function(e){N.debug("[LIFFUTS][sendCustom] liff.shareTargetPicker"),e.sendCustom({type:"liffSdk",params:{placeId:"liff.shareTargetPicker"}})}(o.analytics),c.label=1;case 1:return c.trys.push([1,3,,4]),i=Kr.getInstance(),a=Qe(),s={waitForSubwindowResult:!0},Oe()&&a&&Y(a,"10.11.0")<0&&(s.waitForSubwindowResult=!1),[4,i.init({messages:t,isMultiple:e,referrer:{liffId:r,url:location.origin},options:s})];case 2:return[2,c.sent()];case 3:throw(u=c.sent())instanceof ue?u:ce(H,u.message);case 4:return[2]}}))}))},this.checkPermission=function(){if(ot())throw ce("FORBIDDEN","The operation is not allowed in the SubWindow");var e=((Fe()||{}).availability||{}).shareTargetPicker||{},t=e.permission,n=e.minVer;if(!t)throw Oe()?ce("FORBIDDEN","Need LINE App "+n+" at least or consent on shareTargetPicker usage on LINE developer site"):ce("FORBIDDEN","Need consent on shareTargetPicker usage on LINE developer site")}}return e.prototype.install=function(){return this.shareTargetPicker},e}()),qr=Object.defineProperties({},{getOS:{value:$e,enumerable:!0,writable:!0},getVersion:{value:Kn,enumerable:!0,writable:!0},getLanguage:{value:function(){return navigator.language},enumerable:!0,writable:!0},isInClient:{value:Oe,enumerable:!0,writable:!0},isLoggedIn:{value:Xe,enumerable:!0,writable:!0},logout:{value:et,enumerable:!0,writable:!0},getAccessToken:{value:Ge,enumerable:!0,writable:!0},getIDToken:{value:Me,enumerable:!0,writable:!0},getDecodedIDToken:{value:qe,enumerable:!0,writable:!0},getContext:{value:Fe,enumerable:!0,writable:!0},openWindow:{value:function(e){if(!function(e){if(!e||"object"!=typeof e)return!1;var t=e,n=t.url,r=Xn([typeof n,typeof t.external],2),o=r[0],i=r[1];return"string"===o&&""!==n&&("undefined"===i||"boolean"===i)}(e))throw ce(B,"Invalid parameters for liff.openWindow()");var t=Qe();if(Oe())if(null!==t&&"ios"===$e()&&Y(t,"9.19")>=0||!window._liff.postMessage){var n=e.url,r=e.external,o=void 0!==r&&r;window.open(function(e,t){var n,r,o,i,a,s,u,c,l,f;return-1!==(f=e).indexOf("#")&&-1!==f.indexOf("?")&&f.indexOf("#")5?Qn("Number of messages should be in range 1 to 5."):mt(Et("message"),{method:"POST",body:JSON.stringify({messages:e})}).catch(Yn)}),"chat_message.write"),enumerable:!0,writable:!0},subWindow:{value:fn,enumerable:!0,writable:!0},ready:{value:Se,enumerable:!0,writable:!0},id:{get:function(){return Ce().liffId||null},enumerable:!0},_dispatchEvent:{value:function(e){var t={};try{t=JSON.parse(e)}catch(r){throw ce(B,r.message)}var n=new CustomEvent("liffEvent",{detail:t});N.debug("[client dispatchEvent to js]",{type:n.type,detail:n.detail}),window.dispatchEvent(n)},enumerable:!0,writable:!0},_call:{value:At,enumerable:!0,writable:!0},_addListener:{value:Pt,enumerable:!0,writable:!0},_removeListener:{value:Ct,enumerable:!0,writable:!0},_postMessage:{value:xt,enumerable:!0,writable:!0}}),zr=new nr,Zr=new rr(zr,new function(e,t){this._driver=e,this.liff=t,this.hooks=this._driver.hooks,this.internalHooks=this._driver.internalHooks}(zr,qr),{namespacePrefix:""}).install();[new rr(zr,new function(e,t){this._driver=e,this.liff=t,this.hooks=this._driver.hooks}(zr,qr)),new zn,new Vn,new cr,mr,dr,rt,Nr,Jr].forEach((function(e){Zr.call(qr,e)}));var Xr=qr;t.default=Xr}]).default}));